﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LoveEat.Infrastructure.Interfaces
{
    public interface IBaseRespository<T>
    {
        /// <summary>
        /// 上下文
        /// </summary>
        MyDbcontext DB {  get; }
        /// <summary>
        /// 查询方法
        /// </summary>
        /// <returns></returns>
        IQueryable<T> GetAll();
        /// <summary>
        /// 添加方法
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> AddAsync(T t);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> UpdateAsync(T t);
        /// <summary>
        /// 批量添加
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> AddRange(IEnumerable<T> t);
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        Task<int> UpdateRange(IEnumerable<T> t);
    }
}
